package com.memorypalace.pojo;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.google.gson.Gson;

public class Note {
	private String noteId;
	private String deckId;
	private String areaContents;
	private String noteTypeId;
	private String areaNames;
	private Date noteCreateTime;
	private Date noteEditTime;
	
	private NoteType noteType;
	private Deck deck;
	private String title;

	public Note() {
	}

	public Note(String noteId, String deckId, String areaContents,
			String noteTypeId, String areaNames, Date noteCreateTime,
			Date noteEditTime) {
		super();
		this.noteId = noteId;
		this.deckId = deckId;
		this.areaContents = areaContents;
		this.noteTypeId = noteTypeId;
		this.areaNames = areaNames;
		this.noteCreateTime = noteCreateTime;
		this.noteEditTime = noteEditTime;
	}

	public String getNoteId() {
		return noteId;
	}

	public void setNoteId(String noteId) {
		this.noteId = noteId;
	}
	public String getDeckId() {
		return deckId;
	}

	public void setDeckId(String deckId) {
		this.deckId = deckId;
	}

	public String getAreaContents() {
		return areaContents;
	}

	public void setAreaContents(String areaContents) {
		this.areaContents = areaContents;
	}

	public String getNoteTypeId() {
		return noteTypeId;
	}

	public void setNoteTypeId(String noteTypeId) {
		this.noteTypeId = noteTypeId;
	}

	public String getAreaNames() {
		return areaNames;
	}

	public void setAreaNames(String areaNames) {
		this.areaNames = areaNames;
	}

	public Date getNoteCreateTime() {
		return noteCreateTime;
	}

	public void setNoteCreateTime(Date noteCreateTime) {
		this.noteCreateTime = noteCreateTime;
	}

	public Date getNoteEditTime() {
		return noteEditTime;
	}

	public void setNoteEditTime(Date noteEditTime) {
		this.noteEditTime = noteEditTime;
	}
	
	public NoteType getNoteType() {
		return noteType;
	}
	public void setNoteType(NoteType noteType) {
		this.noteType = noteType;
	}
	@Override
	public String toString() {
		return "Note [noteId=" + noteId + ", deckId=" + deckId + ", areaContents=" + areaContents + ", noteTypeId="
				+ noteTypeId + ", areaNames=" + areaNames + ", noteCreateTime=" + noteCreateTime + ", noteEditTime="
				+ noteEditTime + ", noteType=" + noteType + "]";
	}

	public Deck getDeck() {
		return deck;
	}

	public void setDeck(Deck deck) {
		this.deck = deck;
	}

	public String getTitle() {
		Gson g = new Gson();
		List areaNames = g.fromJson(this.getAreaNames(), List.class);
		List areaContents = g.fromJson(this.getAreaContents(), List.class);
		String t = (String) areaContents.get(0);
		
		return t;
	}
	

}
